//
// Created by 32617 on 2025/7/2.
//

#ifndef MAINWIDGET_H
#define MAINWIDGET_H

#include <QMainWindow>
#include <QStandardItemModel>
#include <QSortFilterProxyModel>
#include <stack>
#include <thread>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWidget; }
QT_END_NAMESPACE

class MainWidget : public QMainWindow {
Q_OBJECT

public:
    explicit MainWidget(QWidget *parent = nullptr);
    ~MainWidget() override;

private:
    Ui::MainWidget *ui;
    QStandardItemModel tableModel;
    QStandardItemModel treeModel;
    QSortFilterProxyModel sortFilterProxyModel;
    std::vector<std::vector<QStandardItem*>> tableData;
    std::thread th;
    bool stop= false;
    void Init();
    void InitWidgets();
    void InitSignals();
    //
    void InitTableView();
    void InitTreeView();
    //随机数据
    void RandomTableData();
    void RandomTreeData(QStandardItem *parent,int step=0);
    //刷新数据
    void Flush();
    //小于25变成 0
    void SetLess25To0(QStandardItem *parent);
    void DeleteMod2Equal0(QStandardItem *parent,std::stack<QStandardItem*> &);
};


#endif //MAINWIDGET_H
